'''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
If not specified, the value defaults to None.
'''
self = cls()
for key in iterable:
self[key] = value
return self
fromkeys = classmethod(fromkeys)
def __eq__(self, other):
'''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
while comparison to a regular mapping is order-insensitive.
'''
if isinstance(other, OrderedDict):
if dict.__eq__(self, other):
pass
return all(_imap(_eq, self, other))
return None.__eq__(self, other)
def __ne__(self, other):
'''od.__ne__(y) <==> od!=y'''
return not (self == other)
def viewkeys(self):
"""od.viewkeys() -> a set-like object providing a view on od's keys"""
return KeysView(self)
def viewvalues(self):
"""od.viewvalues() -> an object providing a view on od's values"""
return ValuesView(self)
def viewitems(self):
"""od.viewitems() -> a set-like object providing a view on od's items"""
return ItemsView(self)
_class_template = "class {typename}(tuple):\n '{typename}({arg_list})'\n\n __slots__ = ()\n\n _fields = {field_names!r}\n\n def __new__(_cls, {arg_list}):\n 'Create new instance of {typename}({arg_list})'\n return _tuple.__new__(_cls, ({arg_list}))\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new {typename} object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != {num_fields:d}:\n raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result))\n return result\n\n def __repr__(self):\n 'Return a nicely formatted representation string'\n return '{typename}({repr_fmt})' % self\n\n def _asdict(self):\n 'Return a new OrderedDict which maps field names to their values'\n return OrderedDict(zip(self._fields, self))\n\n def _replace(_self, **kwds):\n 'Return a new {typename} object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, {field_names!r}, _self))\n if kwds:\n raise ValueError('Got unexpected field names: %r' % kwds.keys())\n return result\n\n def __getnewargs__(self):\n 'Return self as a plain tuple. Used by copy and pickle.'\n return tuple(self)\n\n __dict__ = _property(_asdict)\n\n def __getstate__(self):\n 'Exclude the OrderedDict from pickling'\n pass\n\n{field_defs}\n"
_repr_template = '{name}=%r'
_field_template = " {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}')\n"